import { ref } from "vue"
import type { article, articleData, articleInter, categoryData, categoryInter } from "@/types/article"
import { useUserInfoStore } from "@/stores/userInfo";
const userInfoStore = useUserInfoStore()
// 文章分类数据模型
export const categoryModel = ref<categoryInter>({
  id: undefined,
  categoryName: "",
  categoryAlias: "",
  createTime: undefined,
  updateTime: undefined
})

//文章分类列表数据模型
export const categorys = ref<categoryData[]>([
  {
    id: 1,
    categoryName: "",
    categoryAlias: "",
    createTime: "",
    updateTime: ""
  }
])
//文章表单数据模型
export const articleModel = ref<articleInter>({
  title: '',
  categoryId: 1,
  createUser: userInfoStore.userInfo.id,
  coverImg: '',
  content: '',
  state: ''
})
//文章列表数据模型
export const articles = ref<article[]>([
  {
    id: 1,
    title: "",
    content: "",
    coverImg: "",
    state: "",
    createUser: 1,
    nickname: "",
    categoryId: 1,
    createTime: "",
    updateTime: ""
  }
])